import {request} from '../utils/request.js'

const apiUrl = {
	getAddress: '/user/address/getUserAddressList',
	addAddress:'/user/address/addAddress',
	updateAddress:'/user/address/updateAddress',
	removeAddress:'/user/address/removeAddress',
	setDefaultAddress:'/user/address/setDefault'
}

export function getAddress(){
	return request(apiUrl.getAddress, 'GET')
}

export function addAddress(data){
	return request(apiUrl.addAddress, 'POST', data)
}

export function updateAddress(data){
	return request(apiUrl.updateAddress, 'PUT', data)
}

export function removeAddress(data){
	return request(`${apiUrl.removeAddress}?addressId=${data}`, 'DELETE')
}

export function setDefaultAddress(data){
	return request(`${apiUrl.setDefaultAddress}?addressId=${data}`, 'PUT')
}